import request from "@/utils/request";
export function listAllO() {
    return request({
      url: "/order/list",
      method: "get",
    });
  }
  export function payOrder(orderId) {
    return request({
      url: '/order/pay/' + orderId,
      method: 'get',
    });
  }
  // 分页查询订单列表
export function listOrderByPage(query) {
  return request({
    url: '/order/page',
    method: 'get',
    params: query
  })
}
// 删除订单
export function delOrder(orderId) {
  return request({
    url: '/order/' + orderId,
    method: 'delete'
  })
}

//订单挂账
export function startOrder(orderId) {
  return request({
    url: `/order/start/${orderId}`, // 将orderId作为路径变量传递
    method: 'delete'
  })
}

// 查询订单详细
export function getOrder(orderId) {
  return request({
    url: '/order/' + orderId,
    method: 'get'
  })
}

// 新增订单
export function addOrder(data) {
  return request({
    url: '/order',
    method: 'post',
    data: data
  })
}

// 修改订单
export function updateOrder(data) {
  return request({
    url: '/order',
    method: 'put',
    data: data
  })
}

// 新增支付
export function addPayment(data) {
  return request({
    url: '/payment',
    method: 'post',
    data: data
  })
}

// 修改VIP使用次数
export function updateVipTimes(orderId) {
  return request({
    url: '/order/item/' + orderId,
    method: 'delete'
  })
}

// 支付宝接口界面，用不了搁置
export function aliPay(orderNo, amount, name) {
  return request({
    url: '/alipay/pay',
    method: 'get',
    params: {
      orderNo:orderNo,amount:amount,name:name
    }
  })
}

// 支付调用，这个不用
export function aliNotify() {
  return request({
    url: '/alipay/notify',
    method: 'post'
  })
}

// 查询支付结果
export function aliPayMent(orderNo) {
  return request({
    url: '/alipayment/select/' + orderNo,
    method: 'get',
  })
}

// 获得销售额的数据——折线图
export function getLineData(year) {
  return request({
    url: '/payment/line',
    method: 'get',
    params: {
      year: year
    }
  });
}

// 获得理发师的业绩金额——柱状图
export function getStylistPerformanceData(timeUnit, searchTime) {
  return request({
    url: '/payment/search',
    method: 'get',
    params: {
      timeUnit: timeUnit,
      searchTime: searchTime
    }
  });
}